package com.xiaoshuidi.cloud.module.bpm.enums;

import cn.hutool.core.util.ObjectUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

@Getter
@AllArgsConstructor
public enum CustomerTypeEnum {

    COMPANY("企业客户", "company"),
    PERSONAL("个人客户", "personal");

    private String name;
    private String value;

    public static String getNameByValue(String value){
        CustomerTypeEnum customerTypeEnum = Arrays.stream(CustomerTypeEnum.values()).filter(p -> p.getValue().equals(value)).findFirst().orElse(null);
        if(ObjectUtil.isEmpty(customerTypeEnum)){
            return "";
        }
        return customerTypeEnum.getName();
    }
}
